#include<iostream>
using namespace std;

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
private:
	vector<int> ans;	
	
public:
	
	void dfs(TreeNode* root){
		if (!root) {
            return;
        }
		if(root->left)dfs(root->left);
		ans.push_back(root->val);
		if(root->right)dfs(root->right);
	}
	
    vector<int> inorderTraversal(TreeNode* root) {
        dfs(root);
        return ans;
    }
};

//2020.9.14

